<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('goods/index',array('type'=>$type))}">{$goods_name_menu}</a></li>
			<li><a href="{:url('goods/add',array('type'=>$type))}">{$goods_name_add}</a></li>
		</ul>
         <div>
       	<form  class="well form-search" action="{:url('Goods/index',array('type'=>$type))}" method="get">
        <label>{:lang('GOODS_NAME')}:
        <input type="text" name="goods_name" class="form-control" placeholder="请输入商品名称"value="{:input('request.goods_name')}" > </label>
			<if condition="$type neq ''">
			<label>{:lang('库房')}:
				<select class="form-control" name="room">
					<option value="">——请选择——</option>
					<volist name="rooms" id="vo">
						<option value="{$vo.id}" <if condition="$room eq $vo.id">selected</if>>{$vo.room_name}</option>
					</volist>
				</select></label></if>
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('Goods/index',array('type'=>$type))}">清空</a>
        </form>
        </div>
		<form action="{:url('Rbac/listorders')}" method="post">
        	<php>$status = array('1' => '下架', '0' => '上架');</php>
            <!--库存小于10 用红色显示-->
			<table class="table table-hover table-bordered">
				<thead>
					<tr>
                        <th width="3%">ID</th>
						<if condition="$type eq 1">
							<th width="5%">物料编号</th>
						</if>
						<th width="15%">{:lang('GOODS_NAME')}</th>
						<if condition="$type eq 0">
                        <th width="10%">{:lang('GOODS_CATE')}</th>
						</if>
                        <th width="10%">{:lang('PRICE')}</th>
						<if condition="$type eq 1">
							<th width="5%">单位</th>
						</if>
                        <th width="10%">{:lang('SUPPLIER')}</th>
						<if condition="$type neq 1">
                        <th width="12%">{:lang('STOCK')}</th>
						</if>
						<if condition="$type neq ''"> <th width="10%">{:lang('STOREROOM')}</th></if>
						<th width="15%">{:lang('ADD_TIME')}</th>
						<th width="15%">{:lang('ACTIONS')}</th>
					</tr>
				</thead>
				<tbody>
					<foreach name="results" item="vo">
					<tr>
						<td>{$vo.id}</td>
						<if condition="$type eq 1">
							<th width="5%">{$vo['goods_num']}</th>
						</if>
						<td>{$vo.goods_name}</td>
						<if condition="$type eq 0">
                        <td>
							{$vo['cate_name']}
						</td>
						</if>
                        <td>{$vo['price']}</td>
						<if condition="$type eq 1">
							<th width="5%">{$vo['price_unit']}</th>
						</if>
                        <td>{$vo['service']}</td>
						<if condition="$type neq 1">
                        <td>{$vo['stock']}</td>
						</if>
						<if condition="$type neq ''"><td>{$vo['room_name']}</td></if>
						<td><php>echo date('Y-m-d H:i:s', $vo['add_time'])</php></td>
						<td>
							<a href="{:url('Goods/edit',array('id'=>$vo['id'],'type'=>$type))}">{:lang('EDIT')}</a>
							|	
							<a href="{:url('Goods/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
                        </td>
					</tr>
					</foreach>
				</tbody>
			</table>
			<div class="pagination">{$page}</div>
		</form>

	</div>
	<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
    <script type="text/javascript">
		</script>
</body>
</html>